home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / _GUICtrlComboFindString.au3 < prev    next >
Text File  |  2007-09-08  |  2KB  |  45 lines

  1. #include <GuiConstants.au3>
  2. #include <GuiCombo.au3>
  3.  
  4. Opt('MustDeclareVars',1)
  5.  
  6. Dim $Label,$Input,$Btn_Search,$Btn_ExactSearch,$Combo,$Btn_Exit,$Status,$msg,$ret
  7.  
  8. GuiCreate("ComboBox Find String", 392, 254)
  9.  
  10. $Label = GuiCtrlCreateLabel("Enter Search String", 20, 20, 120, 20)
  11. $Input = GuiCtrlCreateInput("", 160, 20, 180, 20)
  12. $Btn_Search = GuiCtrlCreateButton("Search", 160, 50, 90, 30)
  13. $Btn_ExactSearch = GuiCtrlCreateButton("Exact Search", 255, 50, 90, 30)
  14. $Combo = GuiCtrlCreateCombo("", 70, 100, 270, 120)
  15. GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language")
  16. $Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
  17. $Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
  18. GuiSetState()
  19. While 1
  20.     $msg = GuiGetMsg()
  21.     Select
  22.         Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
  23.             ExitLoop
  24.         Case $msg = $Btn_Search
  25.             If(StringLen(GUICtrlRead($Input)) > 0) Then
  26.                 $ret = _GUICtrlComboFindString($Combo,GUICtrlRead($Input))
  27.                 If($ret <> $CB_ERR) Then
  28.                     GUICtrlSetData($Status,'Found "' & GUICtrlRead($Input) & '" at index: ' & $ret)
  29.                 Else
  30.                     GUICtrlSetData($Status,'"' & GUICtrlRead($Input) & '" Not Found')
  31.                 EndIf
  32.             EndIf
  33.         Case $msg = $Btn_ExactSearch
  34.             If(StringLen(GUICtrlRead($Input)) > 0) Then
  35.                 $ret = _GUICtrlComboFindString($Combo,GUICtrlRead($Input),1)
  36.                 If($ret <> $CB_ERR) Then
  37.                     GUICtrlSetData($Status,'Found "' & GUICtrlRead($Input) & '" at index: ' & $ret)
  38.                 Else
  39.                     GUICtrlSetData($Status,'"' & GUICtrlRead($Input) & '" Not Found')
  40.                 EndIf
  41.             EndIf
  42.     EndSelect
  43. WEnd
  44. Exit
  45.